home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / Editions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  15.0 KB  |  474 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Editions.h
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __EDITIONS__
  18. #define __EDITIONS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26. #ifndef __FILES__
  27. #include <Files.h>
  28. #endif
  29. #ifndef __ALIASES__
  30. #include <Aliases.h>
  31. #endif
  32. #ifndef __DIALOGS__
  33. #include <Dialogs.h>
  34. #endif
  35.  
  36.  
  37.  
  38. #if PRAGMA_ONCE
  39. #pragma once
  40. #endif
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #if PRAGMA_IMPORT
  47. #pragma import on
  48. #endif
  49.  
  50. #if PRAGMA_STRUCT_ALIGN
  51.     #pragma options align=mac68k
  52. #elif PRAGMA_STRUCT_PACKPUSH
  53.     #pragma pack(push, 2)
  54. #elif PRAGMA_STRUCT_PACK
  55.     #pragma pack(2)
  56. #endif
  57.  
  58.  
  59. enum {
  60.                                                                 /* resource types  */
  61.     rSectionType                = FOUR_CHAR_CODE('sect'),        /* ResType of saved SectionRecords */
  62.                                                                 /* Finder types for edition files */
  63.     kPICTEditionFileType        = FOUR_CHAR_CODE('edtp'),
  64.     kTEXTEditionFileType        = FOUR_CHAR_CODE('edtt'),
  65.     ksndEditionFileType            = FOUR_CHAR_CODE('edts'),
  66.     kUnknownEditionFileType        = FOUR_CHAR_CODE('edtu'),
  67.     kPublisherDocAliasFormat    = FOUR_CHAR_CODE('alis'),
  68.     kPreviewFormat                = FOUR_CHAR_CODE('prvw'),
  69.     kFormatListFormat            = FOUR_CHAR_CODE('fmts')
  70. };
  71.  
  72.  
  73. enum {
  74.                                                                 /* section types */
  75.     stSubscriber                = 0x01,
  76.     stPublisher                    = 0x0A
  77. };
  78.  
  79.  
  80. enum {
  81.     sumAutomatic                = 0,                            /* subscriber update mode - Automatically     */
  82.     sumManual                    = 1,                            /* subscriber update mode - Manually */
  83.     pumOnSave                    = 0,                            /* publisher update mode - OnSave            */
  84.     pumManual                    = 1                                /* publisher update mode - Manually */
  85. };
  86.  
  87.  
  88. enum {
  89.     kPartsNotUsed                = 0,
  90.     kPartNumberUnknown            = -1
  91. };
  92.  
  93.  
  94. enum {
  95.     kPreviewWidth                = 120,
  96.     kPreviewHeight                = 120
  97. };
  98.  
  99.  
  100. enum {
  101.                                                                 /* bits for formatsMask */
  102.     kPICTformatMask                = 1,
  103.     kTEXTformatMask                = 2,
  104.     ksndFormatMask                = 4
  105. };
  106.  
  107.  
  108.  
  109. enum {
  110.                                                                 /* pseudo-item hits for dialogHooks the first is for NewPublisher or NewSubscriber Dialogs */
  111.     emHookRedrawPreview            = 150,                            /* the following are for SectionOptions Dialog */
  112.     emHookCancelSection            = 160,
  113.     emHookGoToPublisher            = 161,
  114.     emHookGetEditionNow            = 162,
  115.     emHookSendEditionNow        = 162,
  116.     emHookManualUpdateMode        = 163,
  117.     emHookAutoUpdateMode        = 164
  118. };
  119.  
  120.  
  121.  
  122. enum {
  123.                                                                 /* the refcon field of the dialog record during a modalfilter or dialoghook contains one the following */
  124.     emOptionsDialogRefCon        = FOUR_CHAR_CODE('optn'),
  125.     emCancelSectionDialogRefCon    = FOUR_CHAR_CODE('cncl'),
  126.     emGoToPubErrDialogRefCon    = FOUR_CHAR_CODE('gerr')
  127. };
  128.  
  129.  
  130. enum {
  131.     kFormatLengthUnknown        = -1
  132. };
  133.  
  134. /* one byte, stSubscriber or stPublisher */
  135. typedef SignedByte                         SectionType;
  136. /* seconds since 1904 */
  137. typedef unsigned long                     TimeStamp;
  138. /* similar to ResType */
  139. typedef FourCharCode                     FormatType;
  140. /* used in Edition I/O */
  141. typedef Handle                             EditionRefNum;
  142. /* update modes */
  143. /* sumAutomatic, pumSuspend, etc */
  144. typedef short                             UpdateMode;
  145. typedef struct SectionRecord             SectionRecord;
  146. typedef SectionRecord *                    SectionPtr;
  147. typedef SectionPtr *                    SectionHandle;
  148.  
  149. struct SectionRecord {
  150.     SignedByte                         version;                    /* always 0x01 in system 7.0 */
  151.     SectionType                     kind;                        /* stSubscriber or stPublisher */
  152.     UpdateMode                         mode;                        /* auto or manual */
  153.     TimeStamp                         mdDate;                        /* last change in document */
  154.     long                             sectionID;                    /* app. specific, unique per document */
  155.     long                             refCon;                        /* application specific */
  156.     AliasHandle                     alias;                        /* handle to Alias Record */
  157.     long                             subPart;                    /* which part of container file */
  158.     SectionHandle                     nextSection;                /* for linked list of app's Sections */
  159.     Handle                             controlBlock;                /* used internally */
  160.     EditionRefNum                     refNum;                        /* used internally */
  161. };
  162.  
  163.  
  164. struct EditionContainerSpec {
  165.     FSSpec                             theFile;
  166.     ScriptCode                         theFileScript;
  167.     long                             thePart;
  168.     Str31                             thePartName;
  169.     ScriptCode                         thePartScript;
  170. };
  171. typedef struct EditionContainerSpec        EditionContainerSpec;
  172. typedef EditionContainerSpec *            EditionContainerSpecPtr;
  173.  
  174. struct EditionInfoRecord {
  175.     TimeStamp                         crDate;                        /* date EditionContainer was created */
  176.     TimeStamp                         mdDate;                        /* date of last change */
  177.     OSType                             fdCreator;                    /* file creator */
  178.     OSType                             fdType;                        /* file type */
  179.     EditionContainerSpec             container;                    /* the Edition */
  180. };
  181. typedef struct EditionInfoRecord        EditionInfoRecord;
  182.  
  183. struct NewPublisherReply {
  184.     Boolean                         canceled;                    /* O */
  185.     Boolean                         replacing;
  186.     Boolean                         usePart;                    /* I */
  187.     SInt8                             filler;
  188.     Handle                             preview;                    /* I */
  189.     FormatType                         previewFormat;                /* I */
  190.     EditionContainerSpec             container;                    /* I/O */
  191. };
  192. typedef struct NewPublisherReply        NewPublisherReply;
  193.  
  194. struct NewSubscriberReply {
  195.     Boolean                         canceled;                    /* O */
  196.     SignedByte                         formatsMask;
  197.     EditionContainerSpec             container;                    /*I/O*/
  198. };
  199. typedef struct NewSubscriberReply        NewSubscriberReply;
  200.  
  201. struct SectionOptionsReply {
  202.     Boolean                         canceled;                    /* O */
  203.     Boolean                         changed;                    /* O */
  204.     SectionHandle                     sectionH;                    /* I */
  205.     ResType                         action;                        /* O */
  206. };
  207. typedef struct SectionOptionsReply        SectionOptionsReply;
  208. typedef CALLBACK_API( Boolean , ExpModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, short itemOffset, short *itemHit, Ptr yourDataPtr);
  209. typedef CALLBACK_API( short , ExpDlgHookProcPtr )(short itemOffset, short itemHit, DialogPtr theDialog, Ptr yourDataPtr);
  210. typedef STACK_UPP_TYPE(ExpModalFilterProcPtr)                     ExpModalFilterUPP;
  211. typedef STACK_UPP_TYPE(ExpDlgHookProcPtr)                         ExpDlgHookUPP;
  212. enum { uppExpModalFilterProcInfo = 0x0000FBD0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes, 2_bytes, 4_bytes, 4_bytes) */
  213. enum { uppExpDlgHookProcInfo = 0x00003EA0 };                     /* pascal 2_bytes Func(2_bytes, 2_bytes, 4_bytes, 4_bytes) */
  214. #define NewExpModalFilterProc(userRoutine)                         (ExpModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpModalFilterProcInfo, GetCurrentArchitecture())
  215. #define NewExpDlgHookProc(userRoutine)                             (ExpDlgHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpDlgHookProcInfo, GetCurrentArchitecture())
  216. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)  CALL_FIVE_PARAMETER_UPP((userRoutine), uppExpModalFilterProcInfo, (theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  217. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppExpDlgHookProcInfo, (itemOffset), (itemHit), (theDialog), (yourDataPtr))
  218.  
  219. enum {
  220.     ioHasFormat                    = 0,
  221.     ioReadFormat                = 1,
  222.     ioNewFormat                    = 2,
  223.     ioWriteFormat                = 3
  224. };
  225.  
  226.  
  227. typedef SignedByte                         FormatIOVerb;
  228.  
  229. enum {
  230.     eoOpen                        = 0,
  231.     eoClose                        = 1,
  232.     eoOpenNew                    = 2,
  233.     eoCloseNew                    = 3,
  234.     eoCanSubscribe                = 4
  235. };
  236.  
  237. typedef SignedByte                         EditionOpenerVerb;
  238.  
  239. struct FormatIOParamBlock {
  240.     long                             ioRefNum;
  241.     FormatType                         format;
  242.     long                             formatIndex;
  243.     unsigned long                     offset;
  244.     Ptr                             buffPtr;
  245.     unsigned long                     buffLen;
  246. };
  247. typedef struct FormatIOParamBlock        FormatIOParamBlock;
  248. typedef struct EditionOpenerParamBlock     EditionOpenerParamBlock;
  249. typedef CALLBACK_API( short , FormatIOProcPtr )(FormatIOVerb selector, FormatIOParamBlock *PB);
  250. typedef CALLBACK_API( short , EditionOpenerProcPtr )(EditionOpenerVerb selector, EditionOpenerParamBlock *PB);
  251. typedef STACK_UPP_TYPE(FormatIOProcPtr)                         FormatIOUPP;
  252. typedef STACK_UPP_TYPE(EditionOpenerProcPtr)                     EditionOpenerUPP;
  253.  
  254. struct EditionOpenerParamBlock {
  255.     EditionInfoRecord                 info;
  256.     SectionHandle                     sectionH;
  257.     const FSSpec *                    document;
  258.     OSType                             fdCreator;
  259.     long                             ioRefNum;
  260.     FormatIOUPP                     ioProc;
  261.     Boolean                         success;
  262.     SignedByte                         formatsMask;
  263. };
  264.  
  265. enum { uppFormatIOProcInfo = 0x00000360 };                         /* pascal 2_bytes Func(1_byte, 4_bytes) */
  266. enum { uppEditionOpenerProcInfo = 0x00000360 };                 /* pascal 2_bytes Func(1_byte, 4_bytes) */
  267. #define NewFormatIOProc(userRoutine)                             (FormatIOUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFormatIOProcInfo, GetCurrentArchitecture())
  268. #define NewEditionOpenerProc(userRoutine)                         (EditionOpenerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppEditionOpenerProcInfo, GetCurrentArchitecture())
  269. /* 
  270.  Section events now arrive in the message buffer using the AppleEvent format.
  271.  The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  272.  ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  273.  The following is a sample buffer
  274.  
  275.  name       offset     contents
  276.  ----       ------     --------
  277.  header           0      'aevt'
  278.  majorVersion     4      0x01
  279.  minorVersion     6      0x01
  280.  endOfMetaData     8      ';;;;' 
  281.  directObjKey     12  '----' 
  282.  paramType      16  'tid ' 
  283.  paramLength      20  0x0008 
  284.  tempIDType      24  'sect' 
  285.  tempID            28  the SectionHandle <-- this is want you want
  286. */
  287.  
  288.  
  289. enum {
  290.     sectionEventMsgClass        = FOUR_CHAR_CODE('sect'),
  291.     sectionReadMsgID            = FOUR_CHAR_CODE('read'),
  292.     sectionWriteMsgID            = FOUR_CHAR_CODE('writ'),
  293.     sectionScrollMsgID            = FOUR_CHAR_CODE('scrl'),
  294.     sectionCancelMsgID            = FOUR_CHAR_CODE('cncl')
  295. };
  296.  
  297.  
  298. enum {
  299.     currentEditionMgrVers        = 0x0011
  300. };
  301.  
  302.  
  303.  
  304. #if !TARGET_RT_MAC_CFM
  305. EXTERN_API( OSErr )
  306. InitEditionPack                    (void)                                                        FIVEWORDINLINE(0x3F3C, 0x0011, 0x303C, 0x0100, 0xA82D);
  307.  
  308. #else
  309. #define InitEditionPack() InitEditionPackVersion(currentEditionMgrVers)
  310. EXTERN_API( OSErr )
  311. InitEditionPackVersion            (short                     curEditionMgrVers)                    THREEWORDINLINE(0x303C, 0x0100, 0xA82D);
  312.  
  313. #endif  /* !TARGET_RT_MAC_CFM */
  314.  
  315. EXTERN_API( OSErr )
  316. NewSection                        (const EditionContainerSpec * container,
  317.                                  ConstFSSpecPtr         sectionDocument,
  318.                                  SectionType             kind,
  319.                                  long                     sectionID,
  320.                                  UpdateMode             initalMode,
  321.                                  SectionHandle *        sectionH)                            THREEWORDINLINE(0x303C, 0x0A02, 0xA82D);
  322.  
  323. EXTERN_API( OSErr )
  324. RegisterSection                    (const FSSpec *            sectionDocument,
  325.                                  SectionHandle             sectionH,
  326.                                  Boolean *                aliasWasUpdated)                    THREEWORDINLINE(0x303C, 0x0604, 0xA82D);
  327.  
  328. EXTERN_API( OSErr )
  329. UnRegisterSection                (SectionHandle             sectionH)                            THREEWORDINLINE(0x303C, 0x0206, 0xA82D);
  330.  
  331. EXTERN_API( OSErr )
  332. IsRegisteredSection                (SectionHandle             sectionH)                            THREEWORDINLINE(0x303C, 0x0208, 0xA82D);
  333.  
  334. EXTERN_API( OSErr )
  335. AssociateSection                (SectionHandle             sectionH,
  336.                                  const FSSpec *            newSectionDocument)                    THREEWORDINLINE(0x303C, 0x040C, 0xA82D);
  337.  
  338. EXTERN_API( OSErr )
  339. CreateEditionContainerFile        (const FSSpec *            editionFile,
  340.                                  OSType                 fdCreator,
  341.                                  ScriptCode             editionFileNameScript)                THREEWORDINLINE(0x303C, 0x050E, 0xA82D);
  342.  
  343. EXTERN_API( OSErr )
  344. DeleteEditionContainerFile        (const FSSpec *            editionFile)                        THREEWORDINLINE(0x303C, 0x0210, 0xA82D);
  345.  
  346. EXTERN_API( OSErr )
  347. OpenEdition                        (SectionHandle             subscriberSectionH,
  348.                                  EditionRefNum *        refNum)                                THREEWORDINLINE(0x303C, 0x0412, 0xA82D);
  349.  
  350. EXTERN_API( OSErr )
  351. OpenNewEdition                    (SectionHandle             publisherSectionH,
  352.                                  OSType                 fdCreator,
  353.                                  ConstFSSpecPtr         publisherSectionDocument,
  354.                                  EditionRefNum *        refNum)                                THREEWORDINLINE(0x303C, 0x0814, 0xA82D);
  355.  
  356. EXTERN_API( OSErr )
  357. CloseEdition                    (EditionRefNum             whichEdition,
  358.                                  Boolean                 successful)                            THREEWORDINLINE(0x303C, 0x0316, 0xA82D);
  359.  
  360. EXTERN_API( OSErr )
  361. EditionHasFormat                (EditionRefNum             whichEdition,
  362.                                  FormatType             whichFormat,
  363.                                  Size *                    formatSize)                            THREEWORDINLINE(0x303C, 0x0618, 0xA82D);
  364.  
  365. EXTERN_API( OSErr )
  366. ReadEdition                        (EditionRefNum             whichEdition,
  367.                                  FormatType             whichFormat,
  368.                                  void *                    buffPtr,
  369.                                  Size *                    buffLen)                            THREEWORDINLINE(0x303C, 0x081A, 0xA82D);
  370.  
  371. EXTERN_API( OSErr )
  372. WriteEdition                    (EditionRefNum             whichEdition,
  373.                                  FormatType             whichFormat,
  374.                                  const void *            buffPtr,
  375.                                  Size                     buffLen)                            THREEWORDINLINE(0x303C, 0x081C, 0xA82D);
  376.  
  377. EXTERN_API( OSErr )
  378. GetEditionFormatMark            (EditionRefNum             whichEdition,
  379.                                  FormatType             whichFormat,
  380.                                  unsigned long *        currentMark)                        THREEWORDINLINE(0x303C, 0x061E, 0xA82D);
  381.  
  382. EXTERN_API( OSErr )
  383. SetEditionFormatMark            (EditionRefNum             whichEdition,
  384.                                  FormatType             whichFormat,
  385.                                  unsigned long             setMarkTo)                            THREEWORDINLINE(0x303C, 0x0620, 0xA82D);
  386.  
  387. EXTERN_API( OSErr )
  388. GetEditionInfo                    (SectionHandle             sectionH,
  389.                                  EditionInfoRecord *    editionInfo)                        THREEWORDINLINE(0x303C, 0x0422, 0xA82D);
  390.  
  391. EXTERN_API( OSErr )
  392. GoToPublisherSection            (const EditionContainerSpec * container)                    THREEWORDINLINE(0x303C, 0x0224, 0xA82D);
  393.  
  394. EXTERN_API( OSErr )
  395. GetLastEditionContainerUsed        (EditionContainerSpec *    container)                            THREEWORDINLINE(0x303C, 0x0226, 0xA82D);
  396.  
  397. EXTERN_API( OSErr )
  398. GetStandardFormats                (const EditionContainerSpec * container,
  399.                                  FormatType *            previewFormat,
  400.                                  Handle                 preview,
  401.                                  Handle                 publisherAlias,
  402.                                  Handle                 formats)                            THREEWORDINLINE(0x303C, 0x0A28, 0xA82D);
  403.  
  404. EXTERN_API( OSErr )
  405. GetEditionOpenerProc            (EditionOpenerUPP *        opener)                                THREEWORDINLINE(0x303C, 0x022A, 0xA82D);
  406.  
  407. EXTERN_API( OSErr )
  408. SetEditionOpenerProc            (EditionOpenerUPP         opener)                                THREEWORDINLINE(0x303C, 0x022C, 0xA82D);
  409.  
  410. EXTERN_API( OSErr )
  411. CallEditionOpenerProc            (EditionOpenerVerb         selector,
  412.                                  EditionOpenerParamBlock * PB,
  413.                                  EditionOpenerUPP         routine)                            THREEWORDINLINE(0x303C, 0x052E, 0xA82D);
  414.  
  415. EXTERN_API( OSErr )
  416. CallFormatIOProc                (FormatIOVerb             selector,
  417.                                  FormatIOParamBlock *    PB,
  418.                                  FormatIOUPP             routine)                            THREEWORDINLINE(0x303C, 0x0530, 0xA82D);
  419.  
  420. EXTERN_API( OSErr )
  421. NewSubscriberDialog                (NewSubscriberReply *    reply)                                THREEWORDINLINE(0x303C, 0x0232, 0xA82D);
  422.  
  423. EXTERN_API( OSErr )
  424. NewSubscriberExpDialog            (NewSubscriberReply *    reply,
  425.                                  Point                     where,
  426.                                  short                     expansionDITLresID,
  427.                                  ExpDlgHookUPP             dlgHook,
  428.                                  ExpModalFilterUPP         filter,
  429.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B34, 0xA82D);
  430.  
  431. EXTERN_API( OSErr )
  432. NewPublisherDialog                (NewPublisherReply *    reply)                                THREEWORDINLINE(0x303C, 0x0236, 0xA82D);
  433.  
  434. EXTERN_API( OSErr )
  435. NewPublisherExpDialog            (NewPublisherReply *    reply,
  436.                                  Point                     where,
  437.                                  short                     expansionDITLresID,
  438.                                  ExpDlgHookUPP             dlgHook,
  439.                                  ExpModalFilterUPP         filter,
  440.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B38, 0xA82D);
  441.  
  442. EXTERN_API( OSErr )
  443. SectionOptionsDialog            (SectionOptionsReply *    reply)                                THREEWORDINLINE(0x303C, 0x023A, 0xA82D);
  444.  
  445. EXTERN_API( OSErr )
  446. SectionOptionsExpDialog            (SectionOptionsReply *    reply,
  447.                                  Point                     where,
  448.                                  short                     expansionDITLresID,
  449.                                  ExpDlgHookUPP             dlgHook,
  450.                                  ExpModalFilterUPP         filter,
  451.                                  void *                    yourDataPtr)                        THREEWORDINLINE(0x303C, 0x0B3C, 0xA82D);
  452.  
  453.  
  454. #if PRAGMA_STRUCT_ALIGN
  455.     #pragma options align=reset
  456. #elif PRAGMA_STRUCT_PACKPUSH
  457.     #pragma pack(pop)
  458. #elif PRAGMA_STRUCT_PACK
  459.     #pragma pack()
  460. #endif
  461.  
  462. #ifdef PRAGMA_IMPORT_OFF
  463. #pragma import off
  464. #elif PRAGMA_IMPORT
  465. #pragma import reset
  466. #endif
  467.  
  468. #ifdef __cplusplus
  469. }
  470. #endif
  471.  
  472. #endif /* __EDITIONS__ */
  473.  
  474.